From: Kenichi Handa Date: Thu, 29 Jan 2004 02:53:53 +0000 (+0000) Subject: (string_char_to_byte): Optimize for ASCII only string. X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1~1^2~24334 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=2da8504bbbf46d0c1aef01fbd478e7a69b7b62ef;p=emacs.git (string_char_to_byte): Optimize for ASCII only string. (string_byte_to_char): Likewise. --- diff --git a/src/fns.c b/src/fns.c index 6383e09302b..493d7ba2897 100644 --- a/src/fns.c +++ b/src/fns.c @@ -884,12 +884,11 @@ string_char_to_byte (string, char_index) int best_below, best_below_byte; int best_above, best_above_byte; - if (! STRING_MULTIBYTE (string)) - return char_index; - best_below = best_below_byte = 0; best_above = SCHARS (string); best_above_byte = SBYTES (string); + if (best_above == best_above_byte) + return char_index; if (EQ (string, string_char_byte_cache_string)) { @@ -957,12 +956,11 @@ string_byte_to_char (string, byte_index) int best_below, best_below_byte; int best_above, best_above_byte; - if (! STRING_MULTIBYTE (string)) - return byte_index; - best_below = best_below_byte = 0; best_above = SCHARS (string); best_above_byte = SBYTES (string); + if (best_above == best_above_byte) + return byte_index; if (EQ (string, string_char_byte_cache_string)) {